package com.haruhi.bot.entity.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class BaseResponse implements Serializable {

    public static int SUCCESS_CODE = 0;
    public static String SUCCESS_MESSAGE = "ok";
    public static int FAIL_CODE = -1;
    public static String FAIL_MESSAGE = "fail";

    private int code;

    private String message;

    private Object data;

    public static BaseResponse fail(){
        return new BaseResponse(BaseResponse.FAIL_CODE,BaseResponse.FAIL_MESSAGE,null);
    }

    public static BaseResponse fail(String message){
        return new BaseResponse(BaseResponse.FAIL_CODE,message,null);
    }
    public static BaseResponse fail(int code ,String message){
        return new BaseResponse(code,message,null);
    }

    public static BaseResponse success(int code ,String message){
        return new BaseResponse(code,message,null);
    }
    public static BaseResponse success(int code ,String message,Object data){
        return new BaseResponse(code,message,data);
    }
    public static BaseResponse success(String message){
        return new BaseResponse(BaseResponse.SUCCESS_CODE,message,null);
    }
    public static BaseResponse success(){
        return new BaseResponse(BaseResponse.SUCCESS_CODE,BaseResponse.SUCCESS_MESSAGE,null);
    }

}
